package com.cardone.platform.common.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
import com.cardone.platform.common.dao.EntityFileDao;
import com.cardone.platform.common.dto.EntityFileDto;

/**
 * 实体文件服务
 *
 * @author yaohaitao
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class EntityFileDefaultService implements EntityFileService {
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, EntityFileDto saveEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).saveByIdOrCode(mappedClass, saveEntityFile);
	}
	
	@Override
	@Transactional
	public EntityFileDto saveByIdOrCode(EntityFileDto saveEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).saveByIdOrCode(EntityFileDto.class, saveEntityFile);
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, EntityFileDto findEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).findByCodeOrId(mappedClass, findEntityFile);
	}
	
	@Override
	public Integer readByCodeNqIdForCount(EntityFileDto readEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).readByCodeNqIdForCount(readEntityFile);
	}
	
	@Override
	@Transactional
	public int insertByCode(EntityFileDto insertEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).insertByCode(insertEntityFile);
	}
	
	@Override
	@Transactional
	public int updateByCode(EntityFileDto updateEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).updateByCode(updateEntityFile);
	}

	@Override
	@Transactional
	public int deleteByIds(EntityFileDto deleteEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).deleteByIds(deleteEntityFile);
	}

	@Override
	public <P> P findById(Class<P> mappedClass, EntityFileDto findEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).findById(mappedClass, findEntityFile);
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, EntityFileDto findListEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).findListByLikeCode(mappedClass, findListEntityFile);
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(EntityFileDao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, EntityFileDto paginationEntityFile) {
		return ContextHolder.getBean(EntityFileDao.class).paginationByLikeCode(mappedClass, paginationEntityFile);
	}
}